home *** CD-ROM | disk | FTP | other *** search
-
- -- a SET is an unordered collection of elements.
- -- Elements can only occur one time.
- -- Time complexity for data adding is O(1).
- -- Time complexity for data searching is O(n).
- -- Space complexity is O(n).
-
- indexing
-
- names: set;
- contents: generic;
-
- author: "Guichard Damien";
- created: 9,November,1995;
- modified: 9,November,1995
-
- class SET inherit BAG
- rename count as cardinal
- redefine add
- end
- feature
- add (element:SET) is
- -- Add an element to the set.
- do
- if find(element) = Void then
- element.set_next(next)
- set_next(element)
- end
- end -- add
- end -- class 'SET'
-
-